﻿<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

  <!--[if lt IE 9]>
  <script type="text/javascript" src="lib/html5shiv.js" th:src="@{/lib/html5shiv.js}"></script>
  <script type="text/javascript" src="lib/respond.min.js" th:src="@{/lib/respond.min.js}"></script>
  <![endif]-->
  <link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css" th:href="@{/h-ui/css/H-ui.min.css}" />
  <link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css" th:href="@{/h-ui.admin/css/H-ui.admin.css}"/>
  <link rel="stylesheet" type="text/css" href="http://www.bootcss.com/p/font-awesome/assets/css/font-awesome-ie7.min.css" />

  <!--[if IE 6]>
  <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" th:src="@{/lib/DD_belatedPNG_0.0.8a-min.js}"></script>
  <script>DD_belatedPNG.fix('*');</script>
  <![endif]-->

<title>修改密码</title>
</head>
<body>
<div class="pd-20">
  <form class="Huiform" id="loginform" action="" method="post">
    <table class="table table-border table-bordered table-bg">
      <!--<thead>
        <tr>
          <th colspan="2">修改密码</th>
        </tr>
      </thead>-->
      <tbody>
        <tr>
          <th class="text-r" width="50%">旧密码：</th>
          <td><input name="oldPassword" id="oldPassword" class="input-text" type="password" autocomplete="off" placeholder="密码" tabindex="1" datatype="*6-16" nullmsg="请输入旧密码！" errormsg="4~16个字符，区分大小写！"/>
          </td>
        </tr>
        <tr>
          <th class="text-r">新密码：</th>
          <td><input name="newPassword" id="newPassword" class="input-text" type="password" autocomplete="off" placeholder="设置密码" tabindex="2" datatype="*6-16"  nullmsg="请输入您的新密码！" errormsg="4~16个字符，区分大小写！" />
          </td>
        </tr>
        <tr>
          <th class="text-r">再次输入新密码：</th>
          <td><input name="newPassword2" id="newPassword2" class="input-text" type="password" autocomplete="off" placeholder="确认新密码" tabindex="3" datatype="*" recheck="newpassword" nullmsg="请再输入一次新密码！" errormsg="您两次输入的新密码不一致！"/>
          </td>
        </tr>
        <tr>
          <th></th>
          <td>
            <button type="button" id="infoSave" class="btn btn-success radius"  name="admin-password-save">
              <i class="icon-ok"></i> 确定</button>
          </td>
        </tr>
      </tbody>
    </table>
  </form>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"  th:src="@{/lib/jquery/1.9.1/jquery.min.js}"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js" th:src="@{/lib/layer/2.4/layer.js}"></script>
<script type="text/javascript" src="h-ui/js/H-ui.min.js" th:src="@{/h-ui/js/H-ui.min.js}"></script>
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js" th:src="@{/h-ui.admin/js/H-ui.admin.js}"></script>
<!--/_footer /作为公共模版分离出去-->
<script type="text/javascript">
    $(function(){

        $('#infoSave').on('click', function() {
            if($('#newPassword').val()!=$('#newPassword2').val()){
                alert('新密码与确认密码不一致！');
                return false;
            }
            var body = $('form').serializeObject();
            var data={"head": window.parent.parent.indexParam.getHead(),"data":body};
            $.ajax({
                url:window.parent.indexParam.getUrl('user/updatePassword'),
                type:"POST",
                data:JSON.stringify(data),
                contentType:"application/json",  //缺失会出现URL编码，无法转成json对象
                success:function(result){
                    console.log(result);
                    if(result.head.respStatus=="00"){
                        alert(result.head.respDesc);
                    }else{
                        alert(result.head.respDesc);
                    }
                }
            });
        });
    });
</script>

</body>
</html>